#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
    string convertToBase7(int num) {
        string s;
        string s1;
        string s2="0";
        if(num<0){
            s="-"; num=-num;
        }
        else if(num==0)return s2;
        while(num!=0){
            int k=num%7;
            s1+=(k+'0');
            num=num/7;
        }
        reverse(s1.begin(),s1.end());
        s+=s1;
        return s;
    }
};//


int main() {
  Solution s;
  int num;
  cin>>num;
  cout<<s.convertToBase7(num);
}
// Created by LENOVO on 2025/8/4.
//
